{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Principal Component Analysis "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Eigenvalues: [0.74992815+0.j 3.67612927+0.j 8.27394258+0.j]\n",
      "Eigenvector: [[-0.70172743  0.69903712 -0.1375708 ]\n",
      " [ 0.70745703  0.66088917 -0.25045969]\n",
      " [ 0.08416157  0.27307986  0.95830278]]\n",
      "Sorted and Selected Eigen Values: [8.27394258+0.j 3.67612927+0.j]\n",
      "Sorted and Selected Eigen Vector: [[-0.1375708   0.69903712]\n",
      " [-0.25045969  0.66088917]\n",
      " [ 0.95830278  0.27307986]]\n",
      "Principal Components: [[-2.15142276 -0.17311941]\n",
      " [ 3.80418259 -2.88749898]\n",
      " [ 0.15321328 -0.98688598]\n",
      " [-4.7065185   1.30153634]\n",
      " [ 1.29375788  2.27912632]\n",
      " [ 4.0993133   0.1435814 ]\n",
      " [-1.62582148 -2.23208282]\n",
      " [ 2.11448986  3.2512433 ]\n",
      " [-0.2348172   0.37304031]\n",
      " [-2.74637697 -1.06894049]]\n"
     ]
    }
   ],
   "source": [
    "# Import numpy \n",
    "import numpy as np\n",
    "\n",
    "# Import linear algebra module\n",
    "from scipy import linalg as la\n",
    " \n",
    "# Create dataset\n",
    "data=np.array([[7., 4., 3.],\n",
    "               [4., 1., 8.],\n",
    "               [6., 3., 5.],\n",
    "               [8., 6., 1.],\n",
    "               [8., 5., 7.],\n",
    "               [7., 2., 9.],\n",
    "               [5., 3., 3.],\n",
    "               [9., 5., 8.],\n",
    "               [7., 4., 5.],\n",
    "               [8., 2., 2.]])\n",
    " \n",
    "# 1. Calculate the covariance matrix\n",
    "# Center your data\n",
    "data -= data.mean(axis=0)\n",
    "cov = np.cov(data, rowvar=False)\n",
    " \n",
    "# 2. Calculate  eigenvalues and eigenvector of the covariance matrix\n",
    "evals, evecs = la.eig(cov)\n",
    "print(\"Eigenvalues:\", evals)\n",
    "print(\"Eigenvector:\", evecs)\n",
    " \n",
    "# 3. Multiply the original data matrix with Eigenvector matrix. \n",
    "# Sort the Eigen values and vector and select components\n",
    "num_components=2\n",
    "sorted_key = np.argsort(evals)[::-1][:num_components]\n",
    "evals, evecs = evals[sorted_key], evecs[:, sorted_key]\n",
    "print(\"Sorted and Selected Eigen Values:\", evals)\n",
    "print(\"Sorted and Selected Eigen Vector:\", evecs)\n",
    " \n",
    "# Multiply original data and Eigen vector\n",
    "principal_components=np.dot(data,evecs)\n",
    "print(\"Principal Components:\", principal_components)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   principal_component_1  principal_component_2\n",
      "0               2.151423              -0.173119\n",
      "1              -3.804183              -2.887499\n",
      "2              -0.153213              -0.986886\n",
      "3               4.706518               1.301536\n",
      "4              -1.293758               2.279126\n",
      "5              -4.099313               0.143581\n",
      "6               1.625821              -2.232083\n",
      "7              -2.114490               3.251243\n",
      "8               0.234817               0.373040\n",
      "9               2.746377              -1.068940\n"
     ]
    }
   ],
   "source": [
    "# Import pandas and PCA\n",
    "import pandas as pd\n",
    "\n",
    "# Import principal component analysis\n",
    "from sklearn.decomposition import PCA\n",
    " \n",
    "# Create dataset\n",
    "data=np.array([[7., 4., 3.],\n",
    "               [4., 1., 8.],\n",
    "               [6., 3., 5.],\n",
    "               [8., 6., 1.],\n",
    "               [8., 5., 7.],\n",
    "               [7., 2., 9.],\n",
    "               [5., 3., 3.],\n",
    "               [9., 5., 8.],\n",
    "               [7., 4., 5.],\n",
    "               [8., 2., 2.]])\n",
    " \n",
    "# Create and fit PCA Model\n",
    "pca_model = PCA(n_components=2)\n",
    "components = pca_model.fit_transform(data)\n",
    " \n",
    "components_df = pd.DataFrame(data = components, \n",
    "                                       columns = ['principal_component_1', 'principal_component_2'])\n",
    "print(components_df)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Finding Number of Clusters"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### The Elbow Method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZIAAAEWCAYAAABMoxE0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3XmcXFWZ//HPt/csnYTsW6c7LIKsAUJIAgqo7CCIgCCS4DjiKOoo6iCu6OjPZVzGbVQYlbAJjICggGwCCgmBTlgSNgmYPWQh+9rp7uf3xzmdVDrV1beX6lvd/bxfr3pV1V2funXrPnXPPfccmRnOOedcexWlHYBzzrnuzROJc865DvFE4pxzrkM8kTjnnOsQTyTOOec6xBOJc865DukxiUSSSdo/D8vdLGnfzl5uvki6X9L0tONIm6SauE+UpLT+4yS9Fvefc9sx/zWSbspHbIUmrX1W0mOS/jW+vkzSE10dQz505meRdKKkpa1NV1CJRNLxkmZK2iBpraQnJR3ThevftWM1MbP+ZvZGntZ3sKR74ufdJOlRSVPbMP9eBxszO93MZnR+tB0Td26T9IVmw5dKOjGlsPLpm8DP4/7zx2wTSPqgpNqYbFbEA+rxnRVA2sk0qXzts/Eg2Bi3b+ZjSmevqz3i8cYkHdFs+B/j8BMTLKMgvuOCSSSSBgB/Bn4GDAbGAN8AdqQZV75I2g94EpgHjAdGA3cBDxbKjp4Ha4Gr4nfdbbTzR1oNvJhjmVcC/w38P2AEMA74H+Cc9sSYD2kfnDrJ8pjMMx+z0g4qwz+AaU1vJA0BJgOrU4uoPcysIB7ARGB9K9P8C/AysA54AK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s0Yze42QcA4itFs0LTa7MpvQXPkBcfqnmyeR6BjgMTNbHZs5v5nQSVk+zSOcUX1P0jvMbEOWaSYDBxOS4XOE9qqqM8bflvH6BeBmSR8inAlms4DQquwpHY7e9XieSFyh+W/CtYZ+GcPqifuqQqNDZRnjMsvtGzPeN7LnGXfztoCMcKD8lJlNiI/xZtaUiLa0EF97Oll6kWStxe76nFEFgJn9I84/D/iOsncjLEK/I02f5WAz+0jG+MzPcybh7O9oYI5CK7vNrSQUa/1Y0klZxju3iycSV1DMbC1wOyGZNFnI7gPxOcTGLdvoAklF8brJvsCrwAOEhh5LYVfNqn65FkI4czlB0tB44fpi4PFW5rkFmCrpzKYBkk6TdFiz6RYSul9God/t8fH1aGCrmd0E/KBpGmAToethgKeA42KRHZL6Snpb80AkFQFVZvYooSOnQUD/bEHHBHYecJOkCa18RteLeSJxheiHQGbtresIB++ngWNp+Wwhl1cJB/z7gX8zs+2EblVfAuZKmg/8mlauG8bmua8GHgWeB+aa2d2tzLMNOAv4lKTXJL1EaD12VbNJ7wAGx6KpjxP6pgc4DHg6Dv8y8K04/FrgfkmPmtnquMzfS3qBkFgOyhJOMSExzAOeBX4c+yxpKfZnCK3J3tOs8oJzu3jrv8455zrEz0icc851iCcS55xzHeKJxDnnXId4InHOOdchnkicc851iCcS55xzHeKJxDnnXIf8f0GfkoAmii46AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# import pandas\n",
    "import pandas as pd\n",
    "\n",
    "# import matplotlib\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# import K-means \n",
    "from sklearn.cluster import KMeans\n",
    " \n",
    "# Create a DataFrame\n",
    "data=pd.DataFrame({\"X\":[12,15,18,10,8,9,12,20],\n",
    "             \"Y\":[6,16,17,8,7,6,9,18]})\n",
    " \n",
    "wcss_list = []\n",
    "# Run a loop for different value of number of cluster\n",
    "for i in range(1, 6):\n",
    "    # Create and fit the KMeans model\n",
    "    kmeans_model = KMeans(n_clusters = i, random_state = 123)\n",
    "    kmeans_model.fit(data)\n",
    "    # Add the WCSS or inertia of the clusters to the score_list\n",
    "    wcss_list.append(kmeans_model.inertia_)\n",
    "\n",
    "# Plot the inertia(WCSS) and number of clusters    \n",
    "plt.plot(range(1, 6), wcss_list,  marker='*')\n",
    "# set title of the plot\n",
    "plt.title('Selecting Optimum Number of Clusters using Elbow Method')\n",
    "# Set x-axis label\n",
    "plt.xlabel('Number of Clusters K')\n",
    "# Set y-axis label\n",
    "plt.ylabel('Within-Cluster Sum of the Squares(Inertia)')\n",
    "# Display plot\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Silhouette Method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEWCAYAAACJ0YulAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAHmNJREFUeJzt3Xm0HHWd/vH3QwBFFhVzUUwCiRB0IgpiiCiI6IC/IJh4RsDAIOIo6IyAC+qAOAwyegb1p7gxSlB/gooYwSVKFFSWcQMTEAgBkRiDiWGGy74KRp7fH1W3bJq+3ZXc1O2b8LzO6ZOuqm9Vf7puup+u7VuyTUREBMBG/S4gIiLGjoRCRERUEgoREVFJKERERCWhEBERlYRCRERUEgox6iT9o6SLW4Ytacfy+Vckfbh/1T1xSTpS0s/7XUf0V0IhGiFpL0m/lHSPpDsl/ULS7gC2v2771f2usZWkyyS9tW1cFVZruczZkq6RdK+k2yX9VNLkkdY6EpJOkfQXSfdLurv8G710LZbzuPUVG4aEQqxzkrYCfgB8Ft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VI1z0AmAnSYdJ2rg8+DuN4kwngGuAOZI2kTQdOKhl3q8Br5X0f8qDvE+WtM9QjcD/UhwHaNU+7izg7ZJeUp75s7mkAyRt2V5oeUruUZK2KYefB8zib+vgi8B/SJpaLuuFkp5R4z0+hu1bgYuBT0jaStJGknaQ9IpeK7OHXnV0Wl+xAUgoRBPuozgYe6WkByi+CK+nOD1zrZX73A8sl3MH8H7gQNu3l03+jeLX910Up8Ce2zLvCmA28AFgkOIX9vv422fg08BBku6S9Jly3CnA2eVumUNsL6I4rvC58jWWUhyc7eRuihBYLOl+4EfAd4CPldM/SXGs4WLgXuBLwGY13mMnRwCbAjeUdZ3Pmu0We5wadXRaX7EBkJ2twIiIKGRLISIiKgmFiIioJBQiIqKSUIiIiMrG/S5gTY0fP96TJ0/udxkREeuVq6666vbyQsqu1rtQmDx5MosWLep3GRER6xVJ7Veod5TdRxERUUkoREREJaEQERGVhEJERFQSChERUUkoREREJaEQERGVhEJERFQSChERUVnvrmgeicknXNjvEvpq+WkH9LuEiBjjsqUQERGVhEJERFQSChERUUkoREREJaEQERGVRkNB0kxJN0laKumEDtNPl3RN+fidpLubrCciIrpr7JRUSeOAM4D9gJXAQknzbd8w1Mb2u1vaHwu8qKl6IiKitya3FGYAS20vs/0IcB4wu0v7Q4FvNFhPRET00GQoTABWtAyvLMc9jqTtgSnAJcNMP1rSIkmLBgcH13mhERFRaDIU1GGch2k7Bzjf9l87TbQ91/Z029MHBnredzoiItZSk6GwEpjUMjwRWDVM2zlk11FERN81GQoLgamSpkjalOKLf357I0nPBZ4O/KrBWiIioobGQsH2auAY4CLgRmCe7SWSTpU0q6XpocB5tofbtRQREaOk0V5SbS8AFrSNO7lt+JQma4iIiPpyRXNERFQSChERUUkoREREJaEQERGVhEJERFQSChERUUkoREREJaEQERGVhEJERFQSChERUUkoREREJaEQERGVhEJERFQSChERUUkoREREJaEQERGVhEJERFQSChERUUkoREREpdFQkDRT0k2Slko6YZg2h0i6QdISSec2WU9ERHS3cVM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P61DOOIov+cXAb4DTy3tBDFf7QoqeP+e3HbiPJ4D0khoREZVsKURERCWhEBERlYRCRERUEgoREVFJKERERCWhEBERlYRCRERU/j+54bAbpkvB1wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# import pandas \n",
    "import pandas as pd\n",
    "\n",
    "# import matplotlib for data visualization\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# import k-means for performing clustering\n",
    "from sklearn.cluster import KMeans\n",
    "\n",
    "# import silhouette score\n",
    "from sklearn.metrics import silhouette_score\n",
    " \n",
    "# Create a DataFrame\n",
    "data=pd.DataFrame({\"X\":[12,15,18,10,8,9,12,20],\n",
    "             \"Y\":[6,16,17,8,7,6,9,18]})\n",
    " \n",
    "score_list = []\n",
    "\n",
    "# Run a loop for different value of number of cluster\n",
    "for i in range(2, 6):\n",
    "    # Create and fit the KMeans model\n",
    "    kmeans_model = KMeans(n_clusters = i, random_state = 123)\n",
    "    kmeans_model.fit(data)\n",
    "    \n",
    "    # Make predictions\n",
    "    pred=kmeans_model.predict(data)\n",
    "    \n",
    "    # Calculate the Silhouette Score\n",
    "    score = silhouette_score (data, pred, metric='euclidean')\n",
    "    \n",
    "    # Add the Silhouette score of the clusters to the score_list\n",
    "    score_list.append(score)\n",
    "    \n",
    "# Plot the Silhouette score and number of cluster    \n",
    "plt.bar(range(2, 6), score_list)\n",
    "# Set title of the plot \n",
    "plt.title('Silhouette Score Plot')\n",
    "# Set x-axis label\n",
    "plt.xlabel('Number of Clusters K')\n",
    "# Set y-axis label\n",
    "plt.ylabel('Silhouette Scores')\n",
    "# Display plot\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## K-Means Clustering"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "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QQPh8R69qZ/d+AX5J8QZ+Uvn4DcBpwtaTDSfq1v6zF60YDu0bEqIh4B3B9K8ueRjrWhaR+JFeD3pI+d2tE7B8R+5J0cXJGJzbxDJJec/cH9gc+JWl3klCbGUl/+/uSXIFq1mV9ii7AbAsdSdLFwCiSAW82k3anvCIinpW0CJgiaXBEvBgRj0v6GfAb4F9bCZO/AXtI+gHwXyR7FJuIiIckbSfprcDbgfsj4sX06VGSvg5sD2wHzOzEtr0PeKekj6aPBwFvAR5Kt2Er4LaIcBDYFvEegdUsSaNJRgY7EDi3oofGb6TNJs1fkCcBb0ubXJ4mGbTkuIpFvQN4Cdip5TrSL/R9gT8CE4Fr2yhnOslewT+bhVJTgXPSvYnLgNaGS93Axs9i5fMCPhMRo9O/3SMZ1GcOMBZYDPxM0ifaqMmsKg4Cq0lpT41XkzQJLQC+RTq0YkRc2PzlKakXcDzJ8IsjIukl9BjS5iFJHyHp1Gss8H21GD9ZyRjEvSLiFuCrwJg2SpoGnELS2+WvK6YPAJamv95PbuO1zwD7pfc/WjF9JnB2+lokjZS0bXpm1PKI+ClJb5Vt1WRWFTcNWa36FLAgIpqbg34MnCZpXETMrphvLMkIYosrps0B9k7HGr4SODQiFkr6IXAVG7v8hWSowOvTQIE2RruKiCckrQbmRsSqiqe+StID5rPAPJJgaOnbJIPAfBz4fcX0a4ERJGMcCFhBMkzheOA8SeuBlYD3CGyLuPdRM7OSc9OQmVnJOQjMzErOQWBmVnIOAjOzknMQmJmVnIPAzKzkHARmZiX3/wFbPoW6HQmmbwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# import pandas \n",
    "import pandas as pd\n",
    "\n",
    "# import matplotlib for data visualization\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Import K-means\n",
    "from sklearn.cluster import KMeans\n",
    "\n",
    "# Create a DataFrame\n",
    "data=pd.DataFrame({\"X\":[12,15,18,10,8,9,12,20],\n",
    "             \"Y\":[6,16,17,8,7,6,9,18]})\n",
    " \n",
    "# Define number of clusters\n",
    "num_clusters = 2\n",
    " \n",
    "# Create and fit the KMeans model\n",
    "km = KMeans(n_clusters=num_clusters)\n",
    "km.fit(data)\n",
    " \n",
    "# Predict the target variable\n",
    "pred=km.predict(data)\n",
    " \n",
    "# Plot the Clusters\n",
    "plt.scatter(data.X,data.Y,c=pred, marker=\"o\", cmap=\"bwr_r\")\n",
    "# Set title of the plot \n",
    "plt.title('K-Means Clustering')\n",
    "# Set x-axis label\n",
    "plt.xlabel('X-Axis Values')\n",
    "# Set y-axis label\n",
    "plt.ylabel('Y-Axis Values')\n",
    "# Display the plot\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Hierarchical Clustering"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEZCAYAAACaWyIJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAG29JREFUeJzt3XuYXFWd7vHvSxJJuMjFBIhAiCAqcJRWM6AyHuMRFNA5xhkZSZDLCBNQ4hDFOYMcjiAODjqK+AjKhMsElODgCIoDHnWAgIACQVsCEySKQICQC7dcQQi/+WOtkkpT3V2d9K7dnfV+nqeertqX2r/avavevfbetUoRgZmZlWuzugswM7N6OQjMzArnIDAzK5yDwMyscA4CM7PCOQjMzArnIBhmJN0rafIQqGOipJA0spfxp0q6qMpltDH/GZK+szE1DBZJqyTtXncdVcj/o9fWXYdtOAfBECLpQUkH9hh2jKRbGo8jYp+ImNvx4gYoIr4YEcdVvRxJ0yTNyx+0iyX9WNKf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biHh60FeUGYX1NWTFa3Q4Mwo4L3dLvo70gyWttDtdb94LvEnSh/PjbYA9SV0i3xkRiwEk/R74aZ5mPvDufP9WYLakK0md+5lVwkFgRZC0O+nDfCnpXMESUpfZm5E6eGvlU21O1+tigU9GxHq9xuaWQ/MP47zY9PhF8vsyIk6QtD/wfqBbUldEDNmfh7Thy+cIbJMnaRyp99Hz8s8AbgMsjogXSb+vPCJPupL1f12tt+l603P+nwAfz7+QhaTX5d95brfuPfIPFH0OWA7s2u68ZgPhFoFtqsZI6iYd3nmB9BsJ5+Rx3wS+L+kw4EZgdR5+N/CCpN8As/uYrjc95/866UqiX+UfSVkGTBnAa/jnfG5CwPWk34M2G3Q+WWxmVjgfGjIzK5yDwMyscA4CM7PCOQjMzArnIDAzK5yDwMyscA4CM7PC/Td5xU40Ni5g3wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# import pandas \n",
    "import pandas as pd\n",
    "\n",
    "# import matplotlib for data visualization\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Import dendrogram\n",
    "from scipy.cluster.hierarchy import dendrogram\n",
    "from scipy.cluster.hierarchy import linkage\n",
    " \n",
    "# Create a DataFrame\n",
    "data=pd.DataFrame({\"X\":[12,15,18,10,8,9,12,20],\n",
    "             \"Y\":[6,16,17,8,7,6,9,18]})\n",
    "\n",
    "# create dendrogram using ward linkage\n",
    "dendrogram_plot = dendrogram(linkage(data, method = 'ward'))\n",
    "\n",
    "# Set title of the plot\n",
    "plt.title('Hierarchical Clustering: Dendrogram')\n",
    "\n",
    "# Set x-axis label\n",
    "plt.xlabel('Data Items')\n",
    "\n",
    "# Set y-axis label\n",
    "plt.ylabel('Distance')\n",
    "\n",
    "# Display the plot\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
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GbLaF+SLgY2IRnw5gPS7pSbI+JlSTOA8ZJGRMRbEfGUpGuA3wLbdZBMXgDWlfQT4HckRxRLiYiHJC0naQNgQ+CBiHgrnb2JpPOA4cBywF092La9gM0kHZROrwCsDzyUbsMA4DcR4URgy8RHBFa1JI0lGRlsW+CUkh4av5c2myzeQR4KfCRtcnmeZNCST5esalPgbWCV9nWkO/TNgfuALwKXdxLODSRHBe83C6UmACelRxPfBjoaLnUhS76LpfMFfCkixqaPdSIZ1GcysBPwCnCNpM91EpNZWZwIrCqlPTVeStIkNA24mHRoxYg4a/HOU1IdcDDJ8IujI+kl9ADS5iFJnyLp1Gsn4MdqN36ykjGI6yLe020+AAAA6ElEQVTiZuBbwBadhDQROIKkt8vbS8qHATPTX++Hd/Lal4At0+cHlZTfBZyYvhZJYyQNTa+MmhURvyTprbKzmMzK4qYhq1bHA9MiYnFz0M+BoyXtHBGTSpbbiWQEsVdKyiYDG6VjDV8A7B4R0yX9FPgRS7r8hWSowCvThAKdjHYVEU9Lmgs8HBHvlcz6FkkPmC8DT5AkhvYuIRkE5kjgTyXllwOjScY4ENBMMkzhLsDpkhYAcwAfEdgyce+jZmYF56YhM7OCcyIwMys4JwIzs4JzIjAzKzgnAjOzgnMiMDMrOCcCM7OC+3/BIKeJbilxiwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# import pandas \n",
    "import pandas as pd\n",
    "\n",
    "# import matplotlib for data visualization\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Import Agglomerative Clustering\n",
    "from sklearn.cluster import AgglomerativeClustering\n",
    " \n",
    "# Create a DataFrame\n",
    "data=pd.DataFrame({\"X\":[12,15,18,10,8,9,12,20],\n",
    "             \"Y\":[6,16,17,8,7,6,9,18]})\n",
    " \n",
    "# Specify number of clusters\n",
    "num_clusters = 2\n",
    " \n",
    "# Create agglomerative clustering model\n",
    "ac = AgglomerativeClustering(n_clusters = num_clusters, linkage='ward')\n",
    " \n",
    "# Fit the Agglomerative Clustering model\n",
    "ac.fit(data)\n",
    " \n",
    "# Predict the target variable\n",
    "pred=ac.labels_\n",
    " \n",
    "# Plot the Clusters\n",
    "plt.scatter(data.X,data.Y,c=pred, marker=\"o\")\n",
    "\n",
    "# Set title of the plot \n",
    "plt.title('Agglomerative Clustering')\n",
    "# Set x-axis label\n",
    "plt.xlabel('X-Axis Values')\n",
    "# Set y-axis label\n",
    "plt.ylabel('Y-Axis Values')\n",
    "# Display the plot\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## DBSCAN Clustering"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEWCAYAAACaBstRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3XmYHFXZ9/HvL5lskIQtYQuBEIGEsOOwyRb2hF1ZZPEBFIyoqAj4vCgiu4iIoAjKTgRkFwkYDDuoDxEmLCEhBMIe1rCEJBDIMvf7x6mRyaSnqnqmq6qn+/5cV1+Z7nO66q6eSd1d55w6R2aGc845l0a3ogNwzjnXdXjScM45l5onDeecc6l50nDOOZeaJw3nnHOpedJwzjmXmicN5womaYgkk9RQBbH8SdKpRcfhqpcnDVc1JL0qab6kuZJmS/o/ScdK6taqzrWSFkiaF9WbJGnHVuU9JV0gaWZU5xVJF7bZz2GSmqLytyXdI2m7NnWOik7kB7d5fWT0+iVtXv+XpKNijm09SbdKel/Sx5ImSzpBUvcOflyl9vGwpGM6sw0zO9bMzqpUTK72eNJw1WYfM+sHrAX8Cvh/wF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LA/0BSaUcWy7AxtLOjB6vhxhptYnomPoAfzNzDxpuA7zKw1XNyRtCuxGWM3sxy0dz5LOiZpuWk6mhwLDo2afl4D+wAGtNrURMBtYpe0+opP/JoRVIL8PXNlOODcRrjb+2zQVuRY4LrpKOYMw31Zbi/ji/27rcgE/MLNNo8faZnavhQWIdgDeBK6TdEQ7MTmXyJOGqwvR7KB/JDRLvQ6cD/wGwMxOaTnRSuoGHARsbGZDzGwIYSW0Q6PtfI0wMeQOwO8lLd9mPwOAbmZ2O3AqYYnRUm4EvkFYQ6P1DLj9gLejq4LD23nvq8CXo58PbPX6BOC70XuRtJ6kZaMRYu+Z2RWEGVKrdi1vV/28ecrVi28Dr5tZS5PUpcBRknY0s0da1dsBeNPM3mz12qPACIXV9X4F7GJmb0j6A/A7vpiuHcIKaddEyQfgp6WCMbPnJH0KTDKzT1oVnUpYie01wgyl/Uq8/TfALZL+B3iw1etXAkOAJ6MkOYuw5O9I4CeSFgLzAL/ScB3ms9w655xLzZunnHPOpeZJwznnXGqeNJxzzqXmScM551xqnjScc86l5knDOedcap40nHPOpfb/AXSwpgUAkQ85AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# import pandas \n",
    "import pandas as pd\n",
    "\n",
    "# import matplotlib for data visualization\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Import DBSCAN clustering model\n",
    "from sklearn.cluster import DBSCAN\n",
    "\n",
    "# import make_moons dataset\n",
    "from sklearn.datasets import make_moons\n",
    " \n",
    "# Generate some random moon data\n",
    "features, label = make_moons(n_samples = 2000)\n",
    " \n",
    "# Create DBSCAN clustering model\n",
    "db = DBSCAN()\n",
    " \n",
    "# Fit the Spectral Clustering model\n",
    "db.fit(features)\n",
    " \n",
    "# Predict the target variable\n",
    "pred_label=db.labels_\n",
    " \n",
    "# Plot the Clusters\n",
    "plt.scatter(features[:, 0], features[:, 1], c=pred_label, marker=\"o\",cmap=\"bwr_r\")\n",
    "# Set title of the plot\n",
    "plt.title('DBSCAN Clustering')\n",
    "# Set x-axis label\n",
    "plt.xlabel('X-Axis Values')\n",
    "# Set y-axis label\n",
    "plt.ylabel('Y-Axis Values')\n",
    "# Display the plot\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Spectral Clustering"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEWCAYAAABrDZDcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAH3xJREFUeJzt3XmYHGW99vHvPZlJSEI2TNgTgguLiRDCgCj7KigQRRACKCibvCgHZBFFWc5RQUBwQzBCDIpG2YXzyktYlHg8bGEPu+wJgQxhSUjIZJL83j+qBjuTmUnPZLpquuv+XNdc0/10ddevOum+p56qeh5FBGZmVlx1eRdgZmb5chCYmRWcg8DMrOAcBGZmBecgMDMrOAeBmVnBOQjM2iFpiqQfrMbzQ9JHe7KmbtbxXUlX5F2H9W4OAqsoSTtI+l9J70p6S9I/JW1T4XW+JGmPCq9jPUlXSpojaYGkpyWdK2lgD65jtcIIICJ+FBFH91RNVpscBFYxkgYD/w38AlgL2AA4F2jOua761Xz+WsA9QH/gUxExCNgTGAp8ZPUr7Bmru51WHA4Cq6RNACJiakQsi4j3I2JaRDwGIOnIdA/hF+kew9OSdm99sqQhJX91z5b0A0l9Sh4/RtJT6V/kT0oaL+n3wCjgFknvSTpd0ui0q+YoSa8Ad6XPv1bS6+m6p0saU+Z2fQtYABweES+l2/hqRPxH67aVkvR3SUeX3D9S0v+ktyXpEklz0zoekzRW0rHAY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4O3ACcEUH5fyJZK/gg26h1BTgG+nexLlAe9OlLuXfn8XSxwV8MyLGpT8bRzKpz3RgJ2A28HtJX+mgJrOyOAisKqUjNV5G0iX0CnAh6dSKEXFm65enpDrgIJLpF0dHMkroBNLuIUkHkAzqtRPwc7WZP1nJHMR1EXE98H1gfAclTQUOJxnt8uaS9kHAnPSv98M6eO5LwNbp7QNL2m8Djk+fi6RNJA1Mz4yaGxG/IRmtsqOazMririGrVscAr0REa3fQr4AjJe0cEXeXLLcTyQxis0vapgMfT+caPh/YPSJelfRL4Gf8e8hfSKYK/G0aKNDBbFcR8aSkRcCDEbGw5KHvk4yA+TLwOEkwtHURySQwXwbuKmm/AhhNMseBgCaSaQp3AU6T1AK8B3iPwFaLRx81Mys4dw2ZmRWcg8DMrOAcBGZmBecgMDMrOAeBmVnBOQjMzArOQWBmVnD/H/PhFM03K4R6AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# import pandas \n",
    "import pandas as pd\n",
    "\n",
    "# import matplotlib for data visualization\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Import Spectral Clustering\n",
    "from sklearn.cluster import SpectralClustering\n",
    " \n",
    "# Create a DataFrame\n",
    "data=pd.DataFrame({\"X\":[12,15,18,10,8,9,12,20],\n",
    "             \"Y\":[6,16,17,8,7,6,9,18]})\n",
    " \n",
    "# Specify number of clusters\n",
    "num_clusters = 2\n",
    " \n",
    "# Create Spectral Clustering model\n",
    "sc=SpectralClustering(num_clusters, affinity='rbf', n_init=100, assign_labels='discretize')\n",
    " \n",
    "# Fit the Spectral Clustering model\n",
    "sc.fit(data)\n",
    " \n",
    "# Predict the target variable\n",
    "pred=sc.labels_\n",
    " \n",
    "# Plot the Clusters\n",
    "plt.scatter(data.X,data.Y,c=pred, marker=\"o\")\n",
    "# Set title of the plot\n",
    "plt.title('Spectral Clustering')\n",
    "# Set x-axis label\n",
    "plt.xlabel('X-Axis Values')\n",
    "# Set y-axis label\n",
    "plt.ylabel('Y-Axis Values')\n",
    "# Display the plot\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Cluster Performance Evaluation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>pregnant</th>\n",
       "      <th>glucose</th>\n",
       "      <th>bp</th>\n",
       "      <th>skin</th>\n",
       "      <th>insulin</th>\n",
       "      <th>bmi</th>\n",
       "      <th>pedigree</th>\n",
       "      <th>age</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6</td>\n",
       "      <td>148</td>\n",
       "      <td>72</td>\n",
       "      <td>35</td>\n",
       "      <td>0</td>\n",
       "      <td>33.6</td>\n",
       "      <td>0.627</td>\n",
       "      <td>50</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>85</td>\n",
       "      <td>66</td>\n",
       "      <td>29</td>\n",
       "      <td>0</td>\n",
       "      <td>26.6</td>\n",
       "      <td>0.351</td>\n",
       "      <td>31</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>8</td>\n",
       "      <td>183</td>\n",
       "      <td>64</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>23.3</td>\n",
       "      <td>0.672</td>\n",
       "      <td>32</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>89</td>\n",
       "      <td>66</td>\n",
       "      <td>23</td>\n",
       "      <td>94</td>\n",
       "      <td>28.1</td>\n",
       "      <td>0.167</td>\n",
       "      <td>21</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>137</td>\n",
       "      <td>40</td>\n",
       "      <td>35</td>\n",
       "      <td>168</td>\n",
       "      <td>43.1</td>\n",
       "      <td>2.288</td>\n",
       "      <td>33</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   pregnant  glucose  bp  skin  insulin   bmi  pedigree  age  label\n",
       "0         6      148  72    35        0  33.6     0.627   50      1\n",
       "1         1       85  66    29        0  26.6     0.351   31      0\n",
       "2         8      183  64     0        0  23.3     0.672   32      1\n",
       "3         1       89  66    23       94  28.1     0.167   21      0\n",
       "4         0      137  40    35      168  43.1     2.288   33      1"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Import libraries\n",
    "import pandas as pd\n",
    " \n",
    "# read the dataset\n",
    "diabetes = pd.read_csv(\"diabetes.csv\")\n",
    " \n",
    "    \n",
    "# Show top 5-records\n",
    "diabetes.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# split dataset in two parts: feature set and target label \n",
    "feature_set = ['pregnant', 'insulin', 'bmi', 'age','glucose','bp','pedigree']\n",
    "features = diabetes[feature_set] \n",
    "target = diabetes.label\n",
    " \n",
    "# partition data into training and testing set \n",
    "from sklearn.model_selection import train_test_split\n",
    "feature_train, feature_test, target_train, target_test = train_test_split(features, target, test_size=0.3, random_state=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Davies-Bouldin Index: 0.7916877512521091\n",
      "Silhouette Coefficient: 0.5365443098840619\n",
      "Adjusted Rand Score: 0.03789319261940484\n",
      "Jaccard Score: 0.22321428571428573\n",
      "F-Measure(F1-Score): 0.36496350364963503\n",
      "Fowlkes Mallows Score: 0.6041244457314743\n"
     ]
    }
   ],
   "source": [
    "# Import K-means Clustering\n",
    "from sklearn.cluster import KMeans\n",
    "\n",
    "# Import metrics module for performance evaluation\n",
    "from sklearn.metrics import davies_bouldin_score\n",
    "from sklearn.metrics import silhouette_score\n",
    "from sklearn.metrics import adjusted_rand_score\n",
    "from sklearn.metrics import jaccard_score\n",
    "from sklearn.metrics import f1_score\n",
    "from sklearn.metrics import fowlkes_mallows_score\n",
    " \n",
    "# Specify the number of clusters\n",
    "num_clusters = 2\n",
    " \n",
    "# Create and fit the KMeans model\n",
    "km = KMeans(n_clusters=num_clusters)\n",
    "km.fit(feature_train)\n",
    " \n",
    "# Predict the target variable\n",
    "predictions=km.predict(feature_test)\n",
    " \n",
    "# Calculate internal performance evaluation measures\n",
    "print(\"Davies-Bouldin Index:\", davies_bouldin_score(feature_test, predictions))\n",
    "print(\"Silhouette Coefficient:\", silhouette_score(feature_test, predictions))\n",
    "\n",
    "# Calculate External performance evaluation measures\n",
    "print(\"Adjusted Rand Score:\", adjusted_rand_score(target_test, predictions))\n",
    "print(\"Jaccard Score:\", jaccard_score(target_test, predictions))\n",
    "print(\"F-Measure(F1-Score):\", f1_score(target_test, predictions))\n",
    "print(\"Fowlkes Mallows Score:\", fowlkes_mallows_score(target_test, predictions))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
